package com.aphrodite.io.sip.tools;

/** Class InnerTimer implements a separated-thread timer */
class InnerTimer extends Thread {
	InnerTimerListener listener;
	long timeout;

	public InnerTimer(long timeout, InnerTimerListener listener) {
		this.timeout = timeout;
		this.listener = listener;
		start();
	}

	public void run() {
		if (listener != null) {
			try {
				Thread.sleep(timeout);
				listener.onInnerTimeout();
			} catch (Exception e) {
				e.printStackTrace();
			}
			listener = null;
		}
	}
}
